home *** CD-ROM | disk | FTP | other *** search
- Path: news.sprintlink.net!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Destructors in Inheritance
- Date: Tue, 02 Apr 1996 14:55:54 -0500
- Organization: Datalytics, Inc
- Message-ID: <3161864A.5592@datalytics.com>
- References: <Pine.SOL.3.91.960402132752.10414A-100000@vu-vlsi.ee.vill.edu>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Senthilvel Rangaswamy wrote:
- > I have a base class which has a destructor function in it.
- > I derive a class from this base class. If I don't write
- > any destructor for the derived class, will the destructor
- > of the base class will be called when the derived class
- > objects goes out of scope.
- >
-
- Yes it will. Note, however, that when a class is a base class,
- it is wise to code it with a virtual destructor. This ensures
- that the derived class destructors are called correctly even
- through a pointer or reference to the base class.
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-